<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\SearchHouseModel */
/* @var $dataProvider yii\data\ActiveDataProvider */
?>
<div class="house-model-index">


    <?php echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?php if (\backend\components\MenuHelper::checkRoute('create')) {
            echo Html::a('添加房源', ['create'], ['class' => 'btn btn-success']);
        } ?>
    </p>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            'house_name',
            'house_unit_price',
            'return_money',
            'developer',
            // 'checkout',
            // 'property',
            // 'decoration_id',
            // 'house_area',
            // 'total_price',
            // 'address',
            // 'region_id',
            // 'room1',
            // 'room2',
            // 'head',
            // 'phone',

            [
                'class' => 'yii\grid\ActionColumn',
                'template' => '{view}&nbsp;&nbsp;' . \backend\components\MenuHelper::filterActionColumn('{message/index}&nbsp;&nbsp;{house-image/index}&nbsp;&nbsp;{house-type-image/index}&nbsp;&nbsp;{update}&nbsp;&nbsp;{delete}'),
                'buttons' => [
                    'view' => function ($url, $model) {
                        return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', FRONTEND_URL.'/house/detail?from_backend=1&hid='.$model->id, ['title' => '详细','target' => '_blank']);
                    },
                    'message/index' => function ($url, $model) {
                        return Html::a('<span class="glyphicon glyphicon-bullhorn"></span>', \yii\helpers\Url::to(['message/index', 'hid' => $model->id]), ['title' => '图册']);
                    },
                    'house-image/index' => function ($url, $model) {
                        return Html::a('<span class="glyphicon glyphicon-picture"></span>', \yii\helpers\Url::to(['house-image/index', 'house_id' => $model->id]), ['title' => '图册']);
                    },
                    'house-type-image/index' => function ($url, $model) {
                        return Html::a('<span class="glyphicon glyphicon-object-align-left"></span>', \yii\helpers\Url::to(['house-type-image/index', 'house_id' => $model->id]), ['title' => '户型图']);
                    },
                ]
            ],
        ],
    ]); ?>
</div>
